package com.znf4.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.znf4.id.IdGenerator;
import com.znf4.trade.server.TradeManagerServer;
import com.znf4.user.account.entity.UserAccount;

import shaded.org.apache.commons.logging.Log;
import shaded.org.apache.commons.logging.LogFactory;

/**
 * 商品 多表操作Controller 
 */
@Service("commonServiceManager")
public class CommonServiceManager {
	
	private static final Log log = LogFactory.getLog(CommonServiceManager.class);
	
	@Autowired
	private TradeManagerServer tradeManagerServer ;
	
	@Autowired
	private IdGenerator idGenerator;
	

	/**
	 * 函数功能说明 ： 积分商品交易
	 * @参数： @return
	 * @return String
	 * @throws
	 */
	public boolean tradeJifenGood(String id , String type) {
		
		Map<String, Object> params = new HashMap<>() ;
		params.put("id", id) ;
		params.put("type", type) ;
		params.put("buys", 1) ;
		
		UserAccount userAccount = new UserAccount() ;
		userAccount.setId(idGenerator.getAccountInAndOutId());
		userAccount.setNickname("13998641323");
		userAccount.setOut_amount(25);
		return tradeManagerServer.trade(params , userAccount ) ;
		
	}

	
	
	

	

}
